<%@ page  contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="h" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ page import="limousine.util.*" %>
<script language="JavaScript" type="text/JavaScript" src="app/js/wz_tooltip.js"></script>

<div class="data_form">
    <div class="head_data_form">
    </div>
    <div class="show_form">
        <table width="100%" cellspacing="10" cellpadding="0">
            <tr>
                <td align="right">
                    <form id="form1" name="form1" method="post" action="">
                        <!--input type="button" name="button" id="button" value="Add Data" onclick="javascript:goUrl('relatelinkinsertinit.do');" /-->
                    </form>
                </td>
            </tr>
        </table>

        <table width="100%" border="0" cellspacing="10" cellpadding="0">
            <tr>
                <td><strong>Role Systems Manager</strong></td>
            </tr>
            <tr>
                <td>
                    <fieldset>
                        <legend>
                            <strong>กำหนดสิทธิ์</strong></legend>
                        <table width="100%" border="0" cellspacing="5" cellpadding="0">
                            <tr>
                                <td align="center">
                                    <table class="tableForm">
                                        <tr><td valign="center">
                                                <jsp:include page="sys_msg.jsp" />
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            <tr><td align="center">
                                    <logic:empty name="<%=Token.ROLESYSTEMS_ROLE_LIST%>">
                                        <font class="textFormLabelSmall" >No empty role. you can select for edit.</font>
                                    </logic:empty>
                                    <logic:present name="<%=Token.ROLESYSTEMS_ROLE_LIST%>">


                                        <h:form action="/rolesystemsmanagerinsert">
                                            <table class="tableForm">
                                                <tr><td class="textFormLabel" align="right" width="40%">Role:</td>
                                                    <td align="left" width="60%">
                                                        <h:select property="roleId" styleClass="combo" >
                                                            <logic:present name="<%=Token.ROLESYSTEMS_ROLE_LIST%>">
                                                                <logic:iterate id="devs" scope="session"
                                                                               type="limousine.util.SelectItem"
                                                                name="<%=Token.ROLESYSTEMS_ROLE_LIST%>">
                                                            <option value="<bean:write name="devs" property="key" />"  >
                                                                <bean:write name="devs" property="value" /></option>
                                                            </logic:iterate>
                                                        </logic:present>
                                                    </h:select>
                                        </td>
                                    </tr>
                                    <tr><td class="textFormLabel" align="right">Systems:</td>
                                        <td align="left">
                                            <h:select property="systemsId" multiple="true" size="8" styleClass="combo">
                                                <logic:present name="<%=Token.ROLESYSTEMS_SYSTEMS_LIST%>">
                                                    <logic:iterate id="funcs" scope="session" type="limousine.util.SelectItem"
                                                    name="<%=Token.ROLESYSTEMS_SYSTEMS_LIST%>">
                                                <option value="<%=funcs.getKey()%>"  <%=(funcs.getSelect()) ? "selected" : ""%> ><%=funcs.getValue()%></option>
                                            </logic:iterate>
                                        </logic:present>
                                    </h:select>
                                    </td>
                                    </tr>
                                    <tr height="5"><td class="text" align="center" colspan="2">
                                        </td>
                                    </tr>
                                    <tr><td class="text" align="center" colspan="2">
                                            <input type="submit" value="Save" class="button"/>&nbsp;
                                            <input type="reset" class="button"/>
                                            <input type="hidden" name="mode" id="mode" value="0" />
                                            <input type="hidden" name="eid" id="eid" value="" />
                                        </td>
                                    </tr>
                                </table>
                            </h:form>
                        </logic:present>
                </td>
            </tr>
        </table>
        </fieldset>
        </td>
        </tr>
        </table>

        <!-- Make page -->
  <logic:present name="<%=Token.ROLESYSTEMS_PAGE%>">
    <table class="tableData" align="center">
        <tr><td class="text" align="left" colspan="16">
                <%String offset = (String) session.getAttribute(Token.ROLESYSTEMS_CURRENT_OFFSET);
            int pageCount = 1;
                %>
                <logic:iterate id="pits" scope="session"
                               type="limousine.util.PageIterator" name="<%=Token.ROLESYSTEMS_PAGE%>">
                    <%if (offset.equals(pits.getNumber())) {%>
                    [<font color="black"><b><%=pageCount%></b></font>]&nbsp;
                    <%} else {%>
                    <a style="color: #FFFFFF" href="javascript:void(0);" id="<%=pits.getNumber()%>" onClick="javascript:goLink('<%=pits.getLink()%>?offset=<%=pits.getNumber()%>','<%=pits.getNumber()%>');">
                    <font color="red"><b><%=pageCount%></b></font></a>&nbsp;
                    <%}%>
                    <% pageCount++;%>
                </logic:iterate>
            </td>
        </tr>
    </table>
</logic:present>
<!-- Make page -->

        <!-- record -->
        <logic:present name="<%=Token.ROLESYSTEMS%>">
            <table width="100%" border="0" cellspacing="0" cellpadding="10">
                <tr>
                    <td>
                        <fieldset class="bold-th">
                            <legend><strong>search result</strong></legend>
                            <table width="100%" cellspacing="1" cellpadding="1" border="0">
                                <tbody><tr valign="top" align="center">
                                        <th bgcolor="#9a9a9a">No.</th>
                                        <th bgcolor="#9a9a9a">RoleName</th>
                                        <th bgcolor="#9a9a9a">SystemName</th>
                                        <th bgcolor="#9a9a9a">Edit</th>
                                        <th bgcolor="#9a9a9a">Del</th>
                                    </tr>
                                    <%
                                                Func func = new Func();
                                    %>
                                    <logic:iterate id="bean" indexId="count" scope="session" type="limousine.vo.RoleSystems" name="<%=Token.ROLESYSTEMS%>">
                                        <tr bgcolor="#f0f0f0" onmouseout="this.bgColor='#F0F0F0'" onmouseover="this.bgColor='#CCCC99'">
                                            <td align="center" width="8%" ><%=count + 1%></td>
                                            <td class="textData" align="left" ><bean:write name="bean" property="roleName" /></td>
            <td class="textData" align="center" ><bean:write name="bean" property="systemsName" /></td>
                                            <td align="center" width="3%" ><a  href="rolesystemsmanageredit.do?eid=<%=bean.getRoleId()%>" id="E<%=bean.getId()%>" id="E<%=bean.getId()%>" >
                                                    <img src="app/images/edit.gif" border="0" alt="E<%=bean.getId()%>"/>
                                                </a></td>
                                            <td align="center" width="3%" ><a href="#" id="D<%=bean.getId()%>" onclick="javascript:goDelete('rolesystemsmanagerdelete.do?did=<%=bean.getId()%>','D<%=bean.getId()%>','Confirm remove [xxx]');" >
                                                    <img src="app/images/delete.gif" border="0" alt="D<%=bean.getId()%>"/>
                                                </a></td>
                                        </tr>
                                    </logic:iterate>
                                </tbody>
                            </table>
                        </fieldset>
                    </td>
                </tr>
            </table>
        </logic:present>
        <!-- record -->

    </div>
    <div class="bottom_data_form">
    </div>
</div>

